package com.crazymaker.springcloud.message.dao.po;

import lombok.*;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Date;


/**
 * db push_center_m
 drop database   push_center_m0;
 drop database   push_center_m1

 create database push_center_m0 default character set utf8mb4 collate utf8mb4_unicode_ci;
 create database push_center_m1 default character set utf8mb4 collate utf8mb4_unicode_ci;

*/

@Entity
@Table(name = "msg_stream")
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Setter
@Getter
public class MsgStreamPO {
    /**
     * ID
     */
    @Id
    @GenericGenerator(
            name = "commonZkSequenceIdGenerator",
            strategy = "com.crazymaker.springcloud.standard.hibernate.CommonZkSequenceIdGenerator" )
    @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "commonZkSequenceIdGenerator" )


//    @GenericGenerator(
//            name = "snowflakeIdGenerator",
//            strategy = "com.crazymaker.springcloud.standard.hibernate.CommonSnowflakeIdGenerator")
//    @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "snowflakeIdGenerator")
    @Column(name = "stream_id", unique = true, nullable = false, length = 20)
    private Long streamId;


    /**
    * 消息ID  消息唯一标识
    */
    @Column(name = "msg_id",  nullable = true, length = 20)
    private Long msgId;


    /**
     * app编号
     */
    @Column(name = "app_key")
    private String appKey;


    /**
     * 渠道类型
     * 1 websocket  2 alibaba 阿里云推送  3 短信  4 企业微信   5 钉钉   6....
     * 备注： 第2期将改为 位的模式，实现一次多种渠道推送
     */
    @Column(name = "target_type")
    private Integer targetType;

    /**
     * 推送账号，单个的
     */
    @Column(name = "target_id")
    private String targetId;



    /**
     * 发送状态, 0 - 未发送 ;  1 已发送
     * 渠道对接服务做标识，有强制要求
     */
    @Column(name = "send_status")
    private Integer sendStatus;

    /**
     * 发送时间
     * 渠道对接服务做标识，有强制要求
     */
    @Column(name = "send_time")
    private Date sendTime;


    /**
     * 0 未读  1 已读,客户端反馈，没有强制要求
     */
    @Column(name = "read_status")
    private Integer readStatus;


    /**
     * 阅读时间,客户端反馈，没有强制要求
     */
    @Column(name = "read_time")
    private Date readTime;



    @Column(name = "status")
    private Integer status;

}